﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace TermitesMagnets
{
    class AttractAllMagnet:Magnet
    {

        public AttractAllMagnet(Game game, Level parent, Vector2 position, Color color)
            : base(game, parent, position, color, -1)
        {     
        }

        public override void Interact(Termite termite, float timeDiff)
        {
            if (true)
            {
                Vector2 diff = this.Position - termite.Position;
                int distance = (int)diff.LengthSquared();
                if (distance < 2500)
                {
                    termite.Speed += diff / distance * timeDiff * 5000;
                }
            }
        }
    }
}
